<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>子页面</title>
		<script type="text/javascript" src="../../js/jquery-1.11.2.min.js"></script>
	</head>

	<body>
		<div id="childDiv">这是子页面</div>
		<input type="button" value="获取" id="get" />
		<input type="button" value="调用父页面方法" onclick="callParent()" />
		<input type="button" value="刷新父页面" onclick="refresh()" />
	</body>
	<script>
		$("#get").click(function() {
			//父和子可以有相同的id，互不影响
			console.log("子点击")
			
			var pDiv = window.parent.document.getElementById("parentDiv");
			console.log("js:"+pDiv.textContent);
			
			var pDiv = $('#parentDiv', parent.document);
			console.log("jquery:"+pDiv.html());
		})
		
		function refresh() {
			//parent.location.reload();
			//可以指定参数
			
			//刷新本页面
			//$('#main_frame', parent.document).attr("src","child.html");
			 location.reload();
		}
		
		function callParent() {
			window.parent.parent();
		}
		
		function child() {
			console.log("子页面方法");
		}
	</script>

</html>